
public class Main821 {
    public static int k = 0;
    public static void main(String[] args) {
        System.out.println("启动线程");
        MyThread myThread = new MyThread();
        myThread.start();
        MyThread myThread2 = new MyThread();
        myThread2.start();
        MyThread myThread3 = new MyThread();
        myThread3.start();
//        MyRunnable myRunnable = new MyRunnable();
//        myRunnable.run();
    }
    static class MyThread extends Thread{
        @Override
        public void run() {
            for (int i = 0;i< 10;i++){
                System.err.println(this.getName()+"thread 1 K <:"+k++);
            }
        }
    }
    static class MyRunnable implements Runnable{
        @Override
        public void run() {
            int j = 0;
            for (int i = 0;i< 10;i++){
                System.err.println("thread 2 K <:"+k++);
                System.out.println("thread 2 J <:"+j++);
            }
        }
    }
}
